# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
pkgname=flatpak-kcm
pkgver=5.27.10
pkgrel=0
pkgdesc="Flatpak Permissions Management KCM"
# armhf blocked by qt5-qtdeclarative
arch="all !armhf"
url="https://kde.org/plasma-desktop/"
license="GPL-2.0-or-later"
depends="kirigami2"
makedepends="
	extra-cmake-modules
	flatpak-dev
	kcmutils5-dev
	kconfig5-dev
	kdeclarative5-dev
	ki18n5-dev
	kitemmodels5-dev
	qt5-qtdeclarative-dev
	qt5-qtsvg-dev
	samurai
	"
checkdepends="xvfb-run"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
_repo_url="https://invent.kde.org/plasma/flatpak-kcm.git"
source="https://download.kde.org/$_rel/plasma/$pkgver/flatpak-kcm-$pkgver.tar.xz"
subpackages="$pkgname-lang"
install_if="flatpak systemsettings"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build

	# flatpakpermissiontest is broken
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "flatpakpermissiontest"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
5f396753f648e735ae9041c567b065bdd268a33fba183679329cae963c19adb209b4ecfda36ef0bc97ec426b7d933395f627000f466f32f52bde30689243bdb5  flatpak-kcm-5.27.10.tar.xz
"
